// import { formatTimeToStr } from '@/utils/date'
// import { getDict } from '@/utils/dictionary'

export const formatBoolean = (bool) => {
    if (bool !== null) {
        return bool ? '是' : '否'
    } else {
        return ''
    }
}
// export const formatDate = (time) => {
//   if (time !== null && time !== '') {
//     var date = new Date(time)
//     return formatTimeToStr(date, 'yyyy-MM-dd hh:mm:ss')
//   } else {
//     return ''
//   }
// }

export const filterDict = (value, options) => {
    const rowLabel = options && options.filter(item => item.value === value)
    return rowLabel && rowLabel[0] && rowLabel[0].label
}

export const formatDate = (value) => {
    return new Date(value).toLocaleString('zh-CN', {hour12: false});
};

// 使用 Date 对象将时间戳转换为日期
// function timestampToTime(timestamp) {
//     let date = new Date(timestamp);
//     let yy = date.getFullYear();
//     let mm = addZero(date.getMonth() + 1);
//     let dd = addZero(date.getDate());
//     let hh = addZero(date.getHours());
//     let mf = addZero(date.getMinutes());
//     let ss = addZero(date.getSeconds());
//     return `${yy}-${mm}-${dd} ${hh}:${mf}:${ss}`;
// }
